package com.haomin.searcher.indexer.mapper;

import com.haomin.searcher.indexer.model.Document;
import com.haomin.searcher.indexer.model.InvertedRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author haomin
 * @date 2022/10/05 17:46
 **/

@Repository
@Mapper
public interface IndexDatabaseMapper {
    void batchInsertForwardIndexes(@Param("list") List<Document> documentList);

    void batchInsertInvertedIndexes(@Param("list") List<InvertedRecord> recordList);


    // 一个一个插入
//    @Insert("insert into documents (docId, title, url, content) values (#{docId}, #{title}, #{url}, #{content})")
//    void insertDocument(
//            @Param("docId") int docId,
//            @Param("title") String title,
//            @Param("url") String url,
//            @Param("content") String content
//    );
//
//    @Insert("insert into weights (docId, weight) values (#{docId}, #{weight})")
//    @Options(useGeneratedKeys = true, keyProperty = "wid", keyColumn = "wid")
//    void insertWeight(WeightDO weightDO);
//
//    @Insert("insert into word_to_weights (word, wid) values (#{word}, #{wid})")
//    void insertWordToWeight(
//            @Param("word") String word,
//            @Param("wid") int wid);
}